package com.yy.personalcv.service.impl;

import com.yy.personalcv.mapper.ProjectMapper;
import com.yy.personalcv.pojo.Project;
import com.yy.personalcv.service.ProjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class ProjectServiceImpl implements ProjectService {

    @Resource
    private ProjectMapper projectMapper;

    @Override
    public void addProject(Project project) {
        project.setModified(new Date());
        project.setDisplay(1);
        projectMapper.addProject(project);
    }

    @Override
    public List<Project> selectTen(Map map) {
        return projectMapper.selectTen(map);
    }

    @Override
    public int getProjectCounts(int uid) {
        return projectMapper.getProjectCounts(uid);
    }

    @Override
    public Project getProjectDetail(int id, int uid) {
        return projectMapper.getProjectDetail(id,uid);
    }

    @Override
    public void deleteProject(int id, int uid) {
        projectMapper.deleteProject(id,uid);
    }

    @Override
    public List<Project> selectAll(int uid) {
        return projectMapper.selectAll(uid);
    }

    @Override
    public void updateProject(Project project) {
        project.setModified(new Date());
        projectMapper.updateProject(project);
    }
}
